# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AppEngine.V1.Model.AutomaticScaling do
  @moduledoc """
  Automatic scaling is based on request rate, response latencies, and other application metrics.

  ## Attributes

  *   `coolDownPeriod` (*type:* `String.t`, *default:* `nil`) - The time period that the Autoscaler (https://cloud.google.com/compute/docs/autoscaler/) should wait before it starts collecting information from a new instance. This prevents the autoscaler from collecting information when the instance is initializing, during which the collected usage would not be reliable. Only applicable in the App Engine flexible environment.
  *   `cpuUtilization` (*type:* `GoogleApi.AppEngine.V1.Model.CpuUtilization.t`, *default:* `nil`) - Target scaling by CPU usage.
  *   `diskUtilization` (*type:* `GoogleApi.AppEngine.V1.Model.DiskUtilization.t`, *default:* `nil`) - Target scaling by disk usage.
  *   `maxConcurrentRequests` (*type:* `integer()`, *default:* `nil`) - Number of concurrent requests an automatic scaling instance can accept before the scheduler spawns a new instance.Defaults to a runtime-specific value.
  *   `maxIdleInstances` (*type:* `integer()`, *default:* `nil`) - Maximum number of idle instances that should be maintained for this version.
  *   `maxPendingLatency` (*type:* `String.t`, *default:* `nil`) - Maximum amount of time that a request should wait in the pending queue before starting a new instance to handle it.
  *   `maxTotalInstances` (*type:* `integer()`, *default:* `nil`) - Maximum number of instances that should be started to handle requests for this version.
  *   `minIdleInstances` (*type:* `integer()`, *default:* `nil`) - Minimum number of idle instances that should be maintained for this version. Only applicable for the default version of a service.
  *   `minPendingLatency` (*type:* `String.t`, *default:* `nil`) - Minimum amount of time a request should wait in the pending queue before starting a new instance to handle it.
  *   `minTotalInstances` (*type:* `integer()`, *default:* `nil`) - Minimum number of running instances that should be maintained for this version.
  *   `networkUtilization` (*type:* `GoogleApi.AppEngine.V1.Model.NetworkUtilization.t`, *default:* `nil`) - Target scaling by network usage.
  *   `requestUtilization` (*type:* `GoogleApi.AppEngine.V1.Model.RequestUtilization.t`, *default:* `nil`) - Target scaling by request utilization.
  *   `standardSchedulerSettings` (*type:* `GoogleApi.AppEngine.V1.Model.StandardSchedulerSettings.t`, *default:* `nil`) - Scheduler settings for standard environment.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :coolDownPeriod => String.t() | nil,
          :cpuUtilization => GoogleApi.AppEngine.V1.Model.CpuUtilization.t() | nil,
          :diskUtilization => GoogleApi.AppEngine.V1.Model.DiskUtilization.t() | nil,
          :maxConcurrentRequests => integer() | nil,
          :maxIdleInstances => integer() | nil,
          :maxPendingLatency => String.t() | nil,
          :maxTotalInstances => integer() | nil,
          :minIdleInstances => integer() | nil,
          :minPendingLatency => String.t() | nil,
          :minTotalInstances => integer() | nil,
          :networkUtilization => GoogleApi.AppEngine.V1.Model.NetworkUtilization.t() | nil,
          :requestUtilization => GoogleApi.AppEngine.V1.Model.RequestUtilization.t() | nil,
          :standardSchedulerSettings =>
            GoogleApi.AppEngine.V1.Model.StandardSchedulerSettings.t() | nil
        }

  field(:coolDownPeriod)
  field(:cpuUtilization, as: GoogleApi.AppEngine.V1.Model.CpuUtilization)
  field(:diskUtilization, as: GoogleApi.AppEngine.V1.Model.DiskUtilization)
  field(:maxConcurrentRequests)
  field(:maxIdleInstances)
  field(:maxPendingLatency)
  field(:maxTotalInstances)
  field(:minIdleInstances)
  field(:minPendingLatency)
  field(:minTotalInstances)
  field(:networkUtilization, as: GoogleApi.AppEngine.V1.Model.NetworkUtilization)
  field(:requestUtilization, as: GoogleApi.AppEngine.V1.Model.RequestUtilization)
  field(:standardSchedulerSettings, as: GoogleApi.AppEngine.V1.Model.StandardSchedulerSettings)
end

defimpl Poison.Decoder, for: GoogleApi.AppEngine.V1.Model.AutomaticScaling do
  def decode(value, options) do
    GoogleApi.AppEngine.V1.Model.AutomaticScaling.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.AppEngine.V1.Model.AutomaticScaling do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
